<!DOCTYPE html>
<html lang="zh_CN" xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout">

<head>
    <title th:text="${pageTitle}"></title>
    <div data-th-replace="layout/head-top"></div>
</head>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInLeft">
    <div data-th-replace="common/functionDepict"></div>
    <div>
        <div class="row">
            <div class="pt10">
                <div class="col-sm-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-title">
                            <h5>填写基本信息</h5>
                        </div>
                        <div class="ibox-content clearfix pt10">
                            <form class="form-horizontal m-t" id="advertPlaceSaveForm">
                                <div class="form-horizontal">
                                    <input name="id" th:value="${advert['id']}" type="hidden"/>
                                    <input name="placeKey" th:value="${placeKey}" type="hidden"/>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label text-right"><i class="c-red">* </i>广告封面图片</label>
                                        <div class="col-sm-10">
                                            <p>
                                                <button class="btn btn-primary " id="uploadImg" type="button"><i class="fa fa-image"></i>&nbsp;上传封面图</button>
                                                <span th:switch="${placeKey}">
                                                    <small th:case="INDEX" class="fs12 c-red">
                                                        &nbsp;&nbsp;&nbsp;*&nbsp;建议宽高：2200px*500px&nbsp;&nbsp;&nbsp;大小不超过：120kb
                                                    </small>
                                                    <small th:case="APPBANNER" class="fs12 c-red">
                                                        &nbsp;&nbsp;&nbsp;*&nbsp;建议:宽高：750px*400px&nbsp;&nbsp;&nbsp;大小不超过80kb
                                                    </small>
                                                    <small th:case="CLASSINDEX" class="fs12 c-red">
                                                        &nbsp;&nbsp;&nbsp;*&nbsp;建议:宽高：2000px*142px&nbsp;&nbsp;&nbsp;大小不超过100kb
                                                    </small>
                                                     <small th:case="LRBANNER" class="fs12 c-red">
                                                        &nbsp;&nbsp;&nbsp;*&nbsp;建议:宽高：600px*600px&nbsp;&nbsp;&nbsp;大小不超过80kb
                                                    </small>
                                                     <small th:case="QUESTIONINDEX" class="fs12 c-red">
                                                        &nbsp;&nbsp;&nbsp;*&nbsp;建议:宽高：2000px*220px&nbsp;&nbsp;&nbsp;大小不超过100kb
                                                    </small>
                                                </span>
                                            </p>
                                            <div class="clearfix">
                                                <div class="file-box">
                                                    <div class="file">
                                                        <span class="corner" title="删除" id="remove-image"><i class="fa fa-remove"></i></span>
                                                        <div class="image">
                                                            <input type="hidden" id="imageJson" name="imageJson" th:value="${advert['imageJson']}"/>
                                                            <img alt="image" th:if="!${#maps.isEmpty(advert['imageMap'])}" id="advert-image" class="img-responsive" th:src="${advert['imageMap']['url']}">
                                                            <img alt="image" th:if="${#maps.isEmpty(advert['imageMap'])}" id="advert-image"  class="img-responsive" >
                                                        </div>
                                                        <div class="file-name">
                                                            <p  th:if="${advert['imageMap']}!=null" th:text="${advert['imageMap']['fileName']}"></p>
                                                            <small  th:if="${advert['imageMap']}!=null" th:text="'添加时间：'+${advert['imageMap']['createTime']}"></small>
                                                            <p id="file-names" th:if="${advert['imageMap']}==null" ></p>
                                                            <small id="create-time" th:if="${advert['imageMap']}==null"></small>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="clearfix"></div>
                                    </div>
                                    <div class="hr-line-dashed"></div>

                                    <div class="form-group">
                                        <label class="col-sm-2 control-label text-right">跳转目标</label>
                                        <div class="col-sm-8">
                                            <select name="redirectType" id="redirectType" style="width: 100%" class="chosen-select">
                                                <option th:selected="${advert['redirectType']}==0" value="0">请选择跳转类型</option>
                                                <option th:selected="${advert['redirectType']}==1" value="1">专题页面</option>
                                                <option th:selected="${advert['redirectType']}!=1 and ${advert['redirectType']}!=3 and ${advert['redirectType']}!=0" value="2">课程详情</option>
                                                <option th:selected="${advert['redirectType']}==3" value="3">外链</option>
                                            </select>
                                            <span class="help-block m-b-none c-999"> 请选择点击广告跳转类型</span>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>

                                    <div class="form-group new-page-form-box new-page-box" >
                                        <label class="col-sm-2 control-label text-right">是否打开新页面</label>
                                        <div class="col-sm-8">
                                            <select name="newPage" style="width: 100%" class="chosen-select">
                                                <option th:selected="${advert['newPage']}==2" value="2">是</option>
                                                <option th:selected="${advert['newPage']}==1" value="1">否</option>
                                            </select>
                                            <span class="help-block m-b-none c-999"> 点击广告时是否打开新的标签窗口</span>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed new-page-box" th:classappend=" ${advert['redirectType']}!=1 and ${advert['redirectType']}!=2 and ${advert['redirectType']}!=3?'hide':''"></div>

                                    <div class="form-group page-type" th:classappend="${advert['redirectType']}==1?'':'hide'">
                                        <label class="col-sm-2 control-label text-right"><i class="c-red">* </i>专题压缩文件</label>
                                        <div class="col-sm-8">
                                            <p>
                                                <button class="btn btn-primary " id="zipUpload" type="button"><i class="fa fa-file-zip-o"></i>&nbsp;上传专题压缩文件</button>
                                                <span class="c-999"> 请上传格式为html的静态专题页面压缩文件</span>
                                            </p>
                                            <input class="validate-data form-control" id="pageUrl" name="pageUrl" th:value="${advert['redirectType']}==1?${advert['pageUrl']}:''" type="text"/>
                                            <span class="help-block m-b-none c-999"> 上传的压缩包为zip格式，入口使用index命名</span>
                                        </div>
                                        <div class="clearfix"></div>
                                    </div>
                                    <div class="hr-line-dashed page-type" th:classappend="${advert['redirectType']}==1?'':'hide'"></div>

                                    <div class="form-group course-type" th:classappend="${advert['redirectType']}!=1 and ${advert['redirectType']}!=3 and ${advert['redirectType']}!=0?'':'hide'">
                                        <label class="col-sm-2 control-label text-right"><i class="c-red">* </i>选择课程</label>
                                        <div class="col-sm-8">
                                            <p>
                                                <button id="selectCourse" type="button" class="btn btn-primary ">
                                                    <i class="fa fa-mouse-pointer"></i>&nbsp;选择课程
                                                </button>
                                            </p>
                                            <div class="well m-t mt10 no-padding courseSelect" th:classappend="${advert['courseMap']}==null?'hide':''" >
                                                <input type="hidden" name="courseId" id="courseId" th:value="${advert['courseId']}"/>
                                                <ul class="list-group">
                                                    <li class="list-group-item" id="course-li">
                                                        <span class="pull-right">
                                                            <a class="c-999 fs14" title="" id="removeCourse" href="javascript:void(0);">
                                                                <i class="fa fa-remove"></i>
                                                            </a>
                                                        </span>
                                                        <span  class="fs14 courseTypeKey" th:data-courseTypeKey="${advert['courseMap']['courseTypeKey']}" th:if="${advert['courseMap']}!=null" th:text="${advert['courseMap']['courseName']}"></span>
                                                        <span th:if="${advert['courseMap']}==null" id="courseName" class="fs14"></span>
                                                    </li>
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed course-type" th:classappend="${advert['redirectType']}!=1 and ${advert['redirectType']}!=3 and ${advert['redirectType']}!=0?'':'hide'"></div>

                                    <div class="form-group out-link" th:classappend="${advert['redirectType']}==3?'':'hide'">
                                        <label class="col-sm-2 control-label text-right"><i class="c-red">* </i>外链地址</label>
                                        <div class="col-sm-8">
                                            <input class="validate-data form-control" id="pageUrls" name="pageUrls" th:value="${advert['redirectType']}==3?${advert['pageUrl']}:''" type="text"/>
                                            <span class="help-block m-b-none c-999"> 外链地址请以 http://+地址 或 https://+地址 的形式输入</span>
                                        </div>
                                        <div class="clearfix"></div>
                                    </div>
                                    <div class="hr-line-dashed out-link" th:classappend="${advert['redirectType']}==3?'':'hide'"></div>
                                    <div class="form-group page-type" >
                                        <label class="col-sm-2 control-label text-right"><i class="c-red">* </i>排序 </label>
                                        <div class="col-sm-8">
                                            <input class="validate-data form-control"  name="sort" th:value="${advert['sort']}==null?'0':${advert['sort']}" type="number"/>
                                            <span class="help-block m-b-none c-999"> 数字越大排序越靠前</span>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed out-link"></div>
                                    <div class="form-group">
                                        <label class="col-sm-2 control-label text-right">广告描述</label>
                                        <div class="col-sm-8">
                                            <textarea id="depict" style="resize: none;" name="depict" class="form-control" placeholder="请填写广告描述内容" th:text="${advert['depict']}"></textarea>
                                        </div>
                                    </div>
                                    <div class="hr-line-dashed"></div>
                                    <div class="form-group">
                                        <div class="col-sm-8 col-sm-offset-2">
                                            <button class="btn btn-danger submitMaterial" data-status="2" id="submitAdvertPlace" type="button">保存</button>
                                            <button class="btn btn-white ml10" id="onBack" type="button">取消</button>
                                        </div>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div data-th-replace="layout/head-footer"></div>
<script type="text/javascript" th:src="@{{path}/admin/business/course/cou/select-common-course.js?v={v}(path=${staticPath},v=${v})}"></script>
<script type="text/javascript" th:src="@{{path}/admin/business/upload/common-webuploader.js?v={v}(path=${staticPath},v=${v})}"></script>
<script type="text/javascript" th:src="@{{path}/admin/business/op/advert/save-advert.js?v={v}(path=${staticPath},v=${v})}"></script>
</body>
</html>
